<#assign resources="${rc.contextPath}/resources">
<#assign path="${rc.contextPath}">
<head>
<meta charset="UTF-8">
    <title>商品详情</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	 
    
	<link href="${resources}/plugins/fontAwesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="${resources}/plugins/swiper/swiper-3.3.1.min.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/common.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/ppgGoodsDetail.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/pgoodsDetail.css" rel="stylesheet" type="text/css">
 	<#include "setwxshare.ftl"/>
</head>


<body>
<div id="container">
     <div class="commonHeader">商品详情
        <a href="javascript:history.back(-1);" class="fa fa-chevron-left back"></a>
    </div>
    <div id="wrapper">
   		<div class="swiper-container">
            <div class="swiper-wrapper">
		        
					<#list goodsVO.goods.goodsPicList as pic>
						<div class="swiper-slide"><img src="${pic.picurl}"></div>
					</#list>			        
		        
            </div>
            <div class="swiper-pagination"></div>
        </div>
	 <di class="content">  
        <div class="shop-info">
        	<div class="infoTop">
	            <div class="shop-name">${goodsVO.goods.name}</div>
           <div style="position: relative;"> 
           		<div style="padding: 0 100px 0 10px;">现价:${goodsVO.goods.price}元
				  	原价:<span style=" text-decoration: line-through;margin-left: 10px;text-decoration:line-through;color:#999;">${goodsVO.goods.originalPrice}元</span>
				</div>
			   	<div class="score">
			   		<span class="scoreCon" data-score="<#if goodsVO.score==0 > 10 <#else> ${goodsVO.score} </#if>">
	            </div>
	            ${goodsVO.score}分
            </div>
			
            <div class="addBox">
            	${goodsVO.goods.content}
            </div>
           
			<div class="address">
                ${goodsVO.goods.merchant.address}
                <a href="${path}/merchant/map/${goodsVO.goods.merchant.id}"><span class="fa fa-map-marker" ></span></a>
                <a class="fa fa-phone"  href="tel:${goodsVO.goods.merchant.telephone}"></a>
            </div>
			 
        </div>
        <div class="evaluationArea">
            <div class="title">
                <span class="score" >
                     <span class="scoreCon" data-score="<#if goodsVO.score==0 > 10 <#else> ${goodsVO.score} </#if>">
                   		 </span>
					${goodsVO.score}分
                </span>
                <span class="evaNum">${goodsVO.commentNum}评价</span>
            </div>
            <div class="evaluation">
				
            	<#list goodsVO.comments as comment>
	               <div class="userInfo">
                    <div class="portrait">
                        <img src="${comment.member.headimgurl}" alt="">
                    </div>
                    <div class="username"><span>${comment.member.nickname}</span>&nbsp;&nbsp;<div class="vip"><img src="${resources}/images/2_5.png" alt=""></div></div>
                    <p class="score">
                    	<span class="scoreCon" data-score="<#if comment.score==0 >10 <#else> ${comment.score} </#if>"></span>
                        <span class="date">${comment.createTime?date}</span>
                    </p>
                </div>
	                <div class="detail">
	                    <p class="content">${comment.content}</p>
	                    <div class="pics">
	                    	<#list  comment.ComPicList as pic>
		                        <div>
		                            <img src="${pic.picurl}" alt="">
		                        </div>
	                       	</#list>
	                    </div>
	                </div>
				</#list>
            </div>
            <a href="${path}/comment?goodsid=${goodsVO.goods.id}" class="viewAll">查看全部评价
                <i class="fa fa-chevron-right" aria-hidden="true"></i></a>
        </div>
           
         <div class="operate">
            <a href="${path}/manage/commodityCart/cartShow?marketId=3" class="myCart">
                <i class="fa fa-shopping-cart" aria-hidden="true"></i>
                <span>购物车</span> 
                <i class="num" id="num" style="display:none">${cartCount}</i>  
            </a>
            <ul>
                <li><a href="javascript:void (0)" class="buy" id="addCart">加入购物车</a></li>
                <li><a href="${path}/manage/commodityCart/addCart?goodsId=${goodsVO.goods.id}&amount=1" class="shoppingCart" >立即购买</a></li>
            </ul>
        </div>
      </div> 
    </div> 
</div>

</body>

<script src="${resources}/plugins/jquery/2.2.2/jquery.min.js"></script>
<script src="${resources}/js/iscroll-probe.js"></script>
<script src="${resources}/plugins/swiper/swiper-3.3.1.jquery.min.js"></script>
<script src="${resources}/js/ppgGoodsDetail.js"></script>
<script src="${resources}/js/score.js"></script>

<script>
      /*配置轮播图*/
    var mySwiper = new Swiper('.swiper-container', {
        loop: true,
        pagination: '.swiper-pagination',
        autoplay: 2840,
        autoplayDisableOnInteraction: false
    });
   
	  /* 评分 */
	  score($(".scoreCon"));
	  
	
	if("${cartCount}"<=0){
         $("#num").hide();
     }else{
         $("#num").show();
      }

	
	//加入购物车
	$("#addCart").click(function(){
	       
	        var url = "${path}/manage/commodityCart/ajaddCart";
	       
	        $.post(url,{"goodsId":"${goodsVO.goods.id}","amount":1},function(data){
	        
	        if(data.code=="000"){ 
	            $("#num").html(data.result);
                $("#num").show();
                common.alert({content:"已加到购物车"});
	        }else{
	            window.location.href="${path}/manage/commodityCart/cartShow?marketId=3";	
             }
            });
	});
	
</script>
 

 
